package com.ylr.config.framework.feign.client;

import com.ylr.base.common.dto.NameValue;
import com.ylr.config.common.dto.enum_.EnumDto;
import com.ylr.base.common.tool.Result;
import com.ylr.config.framework.feign.YcEnumBaseClient;
import com.ylr.config.framework.feign.configuration.ClientConfiguration;
import com.ylr.config.framework.feign.fallback.YcEnumClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-05-12 15:03:01
 * className: YcEnumClient
 * version: 1.0
 * description:
 */
@FeignClient(value = "ylr-config", contextId = "YcEnumClient", path = "/api/enum",
        fallback = YcEnumClientFallback.class, configuration = ClientConfiguration.class)
public interface YcEnumClient extends YcEnumBaseClient {

    /**
     * 获取枚举配置列表接口
     * 根据枚举类型，获取关联的所有枚举配置
     * @param type 枚举类型
     * @return 枚举配置列表
     */
    @GetMapping("/enums")
    Result<List<NameValue<String>>> getEnumList(@RequestParam("type") Integer type);

    /**
     * 获取枚举值列表接口
     * @param type 枚举类型
     * @return 枚举值列表
     */
    @GetMapping("/value/list")
    Result<List<Long>> getValueList(@RequestParam("type") Integer type);

    /**
     * 获取枚举配置接口
     * @param id 主键
     * @return 枚举配置
     */
    @RequestMapping("/get")
    Result<EnumDto> getEnum(@RequestParam("id") Long id);

}
